home *** CD-ROM | disk | FTP | other *** search
- From: Eric Newhuis <newhuis@ix.netcom.com>
- Message-ID: <31523072.69D3@ix.netcom.com>
- X-Original-Date: Thu, 21 Mar 1996 22:45:38 -0600
- Path: in2.uu.net!bounce-back
- Date: 22 Mar 96 06:54:35 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: Re: Using pointers after delete
- Organization: FutureSource
- References: <4irkhs$8al@crchh327.rich.bnr.ca>
- X-Netcom-Date: Thu Mar 21 8:47:58 PM PST 1996
- X-Mailer: Mozilla 2.0 (Win95; I)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMVJOt+EDnX0m9pzZAQEqPAF/cX9rCL+V3TRwHJ2GsetvBqOSAZ5OSANh
- iIUkW8Ze0Bq2ZcQUzVC9gs7RNMBOMbo/
- =OCOb
-
- joe (j.) halpin wrote:
- >
- > char *pc = new char[128];
- > delete pc;
- > pc = 0;
- >
- > Am I misunderstanding something, or is it illegal to zero out pointers
- > after they've been deallocated? I'm assuming that the intent was to
- > disallow dereferencing of pointers that have been handed to
- > delete. The wording seems to disallow the above as well.
- >
-
- There is not problem using a pointer like that. If you re-read the
- working paper closely you'll notice that the following phrase:
-
- "An invalid pointer con-tains an unusable value: it cannot even be used
- in an expression."
-
- is refering to the value of the pointer, not the pointer itself. In
- other words, replacing the value with zero is fine.
- ---
- [ comp.std.c++ is moderated. To submit articles: try just posting with ]
- [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
- [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
- [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
- [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
-